<!DOCTYPE html>
<html lang="en" ng-app="AldeasInfantiles">
<head>
  <title>Aldeas Infantiles | Administrar Personas</title>
  <?php
	  $this->load->view('head_view');
  ?>
  <script src="<?php echo base_url("assets/js/persons-view.js"); ?>"></script>
  <script src="<?php echo base_url("assets/js/menu-view.js"); ?>"></script>
</head>
<body>
  <div class="container">
    <div class="masthead">
      <?php
        $this->load->view('nav_view');
      ?>
    </div>
    <div class="jumbotron" ng-controller="Persons">
      <form class="form-horizontal" role="form" id="form-edit-donor">
          <h4>Editar Personas <span class="glyphicon glyphicon-user"></span></h4>
          <div class="row">
            <div class="col-xs-4">
              <label for="add-donor-search" class="col-sm-12 control-label">Buscar:</label>
            </div>
            <div class="col-xs-8">
              <a href="#" data-toggle="modal" data-target="#modal-persons" ng-click="showPersons()"><span class="glyphicon glyphicon-search"></span> Buscar</a>
            </div>
          </div>
          <div class="row hide">
            <div class="col-xs-4">
              <label for="person.personid" class="col-sm-12 control-label">Identificador:</label>
            </div>
            <div class="col-xs-8">
              <input type="text" class="form-control" ng-model="person.personid" id="person.personid" name="person.personid" disabled>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="person.personname" class="col-sm-12 control-label">Nombre:</label>
            </div>
            <div class="col-xs-8">
              <input type="text" class="form-control" ng-model="person.personname" id="person.personname" name="person.personname" placeholder="Nombre" required>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="person.personlast1" class="col-sm-12 control-label">Primer Apellido:</label>
            </div>
            <div class="col-xs-8">
              <input type="text" class="form-control" ng-model="person.personlast1" id="person.personlast1" name="person.personlast1" placeholder="Primer Apellido" required>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="person.personlast2" class="col-sm-12 control-label">Segundo Apellido:</label>
            </div>
            <div class="col-xs-8">
              <input type="text" class="form-control" ng-model="person.personlast2" id="person.personlast2" name="person.personlast2" placeholder="Segundo Apellido" required>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="person.personphone" class="col-sm-12 control-label">Tel&eacute;fono:</label>
            </div>
            <div class="col-xs-8">
              <input type="text" class="form-control" ng-model="person.personphone" id="person.personphone" name="person.personphone" placeholder="Tel&eacute;fono" required>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="person.personothers" class="col-sm-12 control-label">Otras se&ntilde;as:</label>
            </div>
            <div class="col-xs-8">
              <textarea rows="2" cols="30" ng-model="person.personothers" id="person.personothers" name="person.personothers">
              </textarea>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
              <label for="selectedCountry" class="col-sm-12 control-label">Pa&iacute;s</label>
            </div>
            <div class="col-xs-8">
              <select id="selectedCountry" name="selectedCountry" class="form-control" title="Seleccione el pa&iacute;s del usuario"
                ng-model="selectedCountry"
                ng-options="country.id_pais as country.ds_pais for country in countries"
                >
              </select>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-4">
            </div>
            <div class="col-xs-8">
              <input type="reset" class="btn btn-default" value="Cancelar"  />
              <input type="submit" class="btn btn-primary" value="Guardar" ng-click="getParams(person)" />
              <div id="messages-users" class="alert alert-dismissable {{alertClass}} {{hiddenClass}}">
                <strong>Mensaje!</strong> <span>{{errorMessage}}</span>
              </div>
            </div>
          </div>
      </form>

      <div class="modal fade" id="modal-persons" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <h4 class="modal-title">Seleccione una persona</h4>
          </div>
              <div class="modal-body">
          <form class="form-horizontal" role="form" id="user-form">
            <div class="row">
              <div class="col-xs-2">
                <h5>Filtrar:</h5>
              </div>
              <div class="col-xs-4">
                <input type="text" class="form-control" placeholder="Nombre" ng-model="query" id="userfilter" name="userfilter" value="" size="25" />
              </div>
            </div>
            <div class="list-group" role="navigation">
              <a ng-repeat="person in persons | filter:query" ng-click="getPersonById(person, $event)" href="" class="list-group-item">{{person.ds_nombre}}</a>
            </div>
          </form>
              </div>
            </div><!-- /.modal-content -->
          </div><!-- /.modal-dialog -->
      </div>
    </div>
    <?php
      $this->load->view('footer_view');
    ?>
  </div>
</body>
</html>